<?php

class Admin_Menu_Controller extends Controller_Abstract 
{
	public function adminSubmenu()
	{
		$query = $this->get('query');
		$domDocument = new DOMDocument();
		$domDocument->preserveWhiteSpace = false;
		$domDocument->encoding = "UTF-8";
		$domDocument->load( dirname(__FILE__)."/view/scripts/submenu.xml" );
		$nodeList = $domDocument->documentElement->childNodes;
		$nodes = array();
		for ($i=0; $i < $nodeList->length; $i++)
		{
			$module = $nodeList->item($i);
			$moduleName = $module->attributes->getNamedItem('name')->nodeValue;
			if ($moduleName != $query->getModule() ) 
			{
				continue;
			}
			$subList = $module->childNodes;
			for ($g=0; $g < $subList->length; $g++)
			{
				//echo iconv("utf-8","windows-1251",$subList->item($g)->nodeValue);
				$nodes[] = array($subList->item($g)->nodeValue, $subList->item($g)->getAttribute('href'));			
			}
		}
		$this->view->menuList = $nodes;
	}
	
	public function defaultAction()
	{
		
	}
	
}
?>